#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <algorithm>
using namespace std;
bool judge(int x);
int main() {
	for (int i = 50; i < 151; i++) {
		if (judge(i)) {
			printf("%d %d %d %d\n", i, i, i * 2, i * 4);
		}
	}
}
bool judge(int x) {
	int a, b, c[6];
	a = 2 * x;
	b = 4 * x;
	c[0] = a / 100;
	c[1] = a / 10 % 10;
	c[2] = a % 10;
	c[3] = b / 100;
	c[4] = b / 10 % 10;
	c[5] = b % 10;
	sort(c, c + 6);
	if (c[5] < 6) {
		return true;
	}
	else {
		return false;
	}
}
